#!/usr/bin/env bash
# Copyright 2014 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

set -e

# Needed because if it is set, cd may print the path it changed to.
unset CDPATH

# Lookup the parent directory of the script (../), the Flutter SDK root.
PROG_NAME="${BASH_SOURCE[0]}"
DEV_DIR="$(
  cd "${PROG_NAME%/*}"
  pwd -P
)"
FLUTTER_ROOT="$(
  cd "$DEV_DIR/.."
  pwd -P
)"

# Run the tool.
pushd "$FLUTTER_ROOT/dev/checks_tool" >/dev/null
dart run --resident --quiet bin/checks.dart
popd >/dev/null
